package org.example.controller;


import lombok.extern.slf4j.Slf4j;
import org.example.internalCommon.dto.OrderInfo;
import org.example.internalCommon.dto.ResponseResult;
import org.example.internalCommon.request.OrderRequest;
import org.example.service.OrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cpf
 * @since 2022-10-10
 */
@RestController
@RequestMapping("/order")
@Slf4j
public class OrderInfoController {

    @Autowired
    OrderInfoService orderInfoService;

    /**
     * 创建订单
     * @param orderRequest
     * @return
     */
    @PostMapping("/add")
    public ResponseResult add(@RequestBody OrderRequest orderRequest){
        log.info("service-order"+orderRequest.getAddress());
        return orderInfoService.add(orderRequest);
    }

}